package cn.iocoder.yudao.module.crossborder.order.dal.mysql.ordercustomer;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.ordercustomer.OrderCustomerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.ordercustomer.vo.*;

/**
 * 跨境电商客户信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderCustomerMapper extends BaseMapperX<OrderCustomerDO> {

    default PageResult<OrderCustomerDO> selectPage(OrderCustomerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderCustomerDO>()
                .eqIfPresent(OrderCustomerDO::getCustomerNo, reqVO.getCustomerNo())
                .eqIfPresent(OrderCustomerDO::getPlatformCustomerId, reqVO.getPlatformCustomerId())
                .eqIfPresent(OrderCustomerDO::getEmail, reqVO.getEmail())
                .eqIfPresent(OrderCustomerDO::getPhone, reqVO.getPhone())
                .likeIfPresent(OrderCustomerDO::getFirstName, reqVO.getFirstName())
                .likeIfPresent(OrderCustomerDO::getLastName, reqVO.getLastName())
                .likeIfPresent(OrderCustomerDO::getFullName, reqVO.getFullName())
                .likeIfPresent(OrderCustomerDO::getNickname, reqVO.getNickname())
                .eqIfPresent(OrderCustomerDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(OrderCustomerDO::getGender, reqVO.getGender())
                .eqIfPresent(OrderCustomerDO::getBirthday, reqVO.getBirthday())
                .eqIfPresent(OrderCustomerDO::getAge, reqVO.getAge())
                .eqIfPresent(OrderCustomerDO::getLanguageCode, reqVO.getLanguageCode())
                .eqIfPresent(OrderCustomerDO::getCurrencyCode, reqVO.getCurrencyCode())
                .eqIfPresent(OrderCustomerDO::getTimezone, reqVO.getTimezone())
                .eqIfPresent(OrderCustomerDO::getCustomerType, reqVO.getCustomerType())
                .eqIfPresent(OrderCustomerDO::getCustomerLevel, reqVO.getCustomerLevel())
                .likeIfPresent(OrderCustomerDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(OrderCustomerDO::getTaxNumber, reqVO.getTaxNumber())
                .eqIfPresent(OrderCustomerDO::getBusinessLicense, reqVO.getBusinessLicense())
                .eqIfPresent(OrderCustomerDO::getRegistrationSource, reqVO.getRegistrationSource())
                .eqIfPresent(OrderCustomerDO::getRegistrationIp, reqVO.getRegistrationIp())
                .betweenIfPresent(OrderCustomerDO::getRegistrationTime, reqVO.getRegistrationTime())
                .betweenIfPresent(OrderCustomerDO::getLastLoginTime, reqVO.getLastLoginTime())
                .eqIfPresent(OrderCustomerDO::getLastLoginIp, reqVO.getLastLoginIp())
                .eqIfPresent(OrderCustomerDO::getTotalOrderCount, reqVO.getTotalOrderCount())
                .eqIfPresent(OrderCustomerDO::getTotalOrderAmount, reqVO.getTotalOrderAmount())
                .eqIfPresent(OrderCustomerDO::getTotalPaidAmount, reqVO.getTotalPaidAmount())
                .eqIfPresent(OrderCustomerDO::getAvgOrderAmount, reqVO.getAvgOrderAmount())
                .betweenIfPresent(OrderCustomerDO::getLastOrderTime, reqVO.getLastOrderTime())
                .eqIfPresent(OrderCustomerDO::getCreditLimit, reqVO.getCreditLimit())
                .eqIfPresent(OrderCustomerDO::getCreditUsed, reqVO.getCreditUsed())
                .eqIfPresent(OrderCustomerDO::getPointsBalance, reqVO.getPointsBalance())
                .eqIfPresent(OrderCustomerDO::getPointsTotal, reqVO.getPointsTotal())
                .eqIfPresent(OrderCustomerDO::getStatus, reqVO.getStatus())
                .eqIfPresent(OrderCustomerDO::getEmailVerified, reqVO.getEmailVerified())
                .eqIfPresent(OrderCustomerDO::getPhoneVerified, reqVO.getPhoneVerified())
                .eqIfPresent(OrderCustomerDO::getKycStatus, reqVO.getKycStatus())
                .eqIfPresent(OrderCustomerDO::getRiskLevel, reqVO.getRiskLevel())
                .eqIfPresent(OrderCustomerDO::getTags, reqVO.getTags())
                .eqIfPresent(OrderCustomerDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OrderCustomerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderCustomerDO::getId));
    }

}